// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import Vueres from 'vue-resource'
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
import '@/assets/iconfont/iconfont.css'
//custom_main.css全局自定义css，按需使用
import '@/assets/css/custom_main.css'
import App from './App'
import router from './router'
import GLOBAL from './global/global.js'
import Util from './global/util.js'
// import BaiduMap from 'vue-baidu-map'
import Amap from 'vue-amap'

Vue.config.productionTip = false
//挂全局变量
Vue.prototype.GLOBAL = GLOBAL
//挂全局util
Vue.prototype.Util = Util
//仿造ionic的push简写跳转
Vue.prototype.pushPage = function (target) {
  this.$router.push(target)
}
//使用vue-resoure
Vue.use(Vueres);
//设定全局拦截，在header中加入身份校验之类的东西
Vue.http.interceptors.push((request, next) => {
  //为所有http添加请求token
  if (Vue.prototype.GLOBAL.serv_token)
    request.headers.set('Authorization', Vue.prototype.GLOBAL.serv_token)
  next((response) => {
    return response
  })
})

//使用mintUI
Vue.use(MintUI);
//全局加载百度地图
// Vue.use(BaiduMap,{ak:"FVIl57x6XyoFs4e76FBPVKZ3Go6lzIzF"});
//加载德高地图
Vue.use(Amap)
Amap.initAMapApiLoader({
  key: "a78dd8d83fde9b504ca3f4beca000d65",
  plugin: ["AMap.Scale", "AMap.OverView", "AMap.ToolBar", "AMap.MapType"],
  v: "1.4.4"
});

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
